/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import javax.transaction.Transaction;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import pojo.BaoCaoCongNo;
import util.HibernateUtil;

/**
 *
 * @author LaiHuynh
 */
public class BaoCaoCongNoDAO {
    public static BaoCaoCongNo layThongTinBaoCaoCongNo(int maBaoCao) {
        BaoCaoCongNo kh = null;
        Session session = HibernateUtil.getSessionFactory().openSession();
        try {
            kh = (BaoCaoCongNo) session.get(BaoCaoCongNo.class, maBaoCao);
            // Hibernate.initialize(qd.getCuaHang());
        } catch (HibernateException ex) {
            //Log the exception
            System.err.println(ex);
        } finally {
            session.close();
        }
        return kh;
    }
    
    public static void themThongBaoCaoCongNo(BaoCaoCongNo bccn) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        session.save(bccn);
        session.getTransaction().commit();
        session.close();
    }
}
